#include<iostream>
#include<stack>
#include<algorithm>
using namespace std;
class MinStack {
public:
    /** initialize your data structure here. */
    stack<int> xStack;
    stack<int> minStack;

    MinStack() {
         minStack.push(INT_MAX);
    }
    
    void push(int x) {
        xStack.push(x);
       minStack.push(::min(minStack.top(), x));

    }
    
    void pop() {
        xStack.pop();
        minStack.pop();
    }
    
    int top() {
        return xStack.top();
    }
    
    int min() {
        return minStack.top();
    }
};